// install packages if needed
ssc install estout, replace
ssc install coefplot, replace

cd "C:\Users\bescoran\Dropbox (Personal)\PhD Research\Papers and Presentations\Cross-National Discrimination\Revisions - post EPSR\Files for Dataverse"
// Open dataset
use "Dataset (Discrimination and Political Engagement - A Cross-national Test)", clear

// Note: some of these datasets have restrictions on circulation, so the original variables are not included. 
// The following code is for the models and figures in the main text and the appendix. Contact the author for more information.  





///////////////////////////Figure 1, Interest in Politics

eststo  clear

//Canada

quietly eststo nocontrols_Canada: reg interest disc  if nonwhite==1 & country==0
quietly eststo controls_Canada: reg interest disc age edu income imm woman if nonwhite==1  & country==0

//Denmark
quietly eststo nocontrols_Denmark:  reg  interest disc if nonwhite==1  & country==1
 eststo controls_Denmark:  reg interest disc age edu income imm woman if nonwhite==1  & country==1

//France
quietly eststo nocontrols_France:  reg  interest disc if nonwhite==1  & country==4
quietly eststo controls_France: reg interest disc age edu income imm woman if nonwhite==1  & country==4

//Germany
 eststo nocontrols_Germany: reg interest disc  if nonwhite==1 & country==2
 eststo controls_Germany: reg interest disc age edu income imm woman if nonwhite==1  & country==2

//UK
quietly eststo nocontrols_UnitedKingdom:  reg interest disc  if nonwhite==1 & country==3
quietly eststo controls_UnitedKingdom:  reg interest disc age edu income imm woman if nonwhite==1  & country==3

//US
quietly eststo nocontrols_UnitedStates:  reg interest disc  if nonwhite==1 & country==5
quietly eststo controls_UnitedStates:  reg interest disc age edu income imm woman if nonwhite==1  & country==5

quietly eststo nocontrols_US_2008:  reg interest disc  if nonwhite==1 & country==6
quietly eststo controls_US_2008:  reg interest disc age edu income imm woman if nonwhite==1  & country==6



// Table
 
 esttab nocontrols_Canada controls_Canada  nocontrols_Denmark controls_Denmark nocontrols_France controls_France nocontrols_Germany controls_Germany /// 
 using TableInterestA.tex , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Interest in Politics A)   nonumbers ///
 mtitles("Canada" "Canada"  "Denmark" "Denmark" "France" "France" "Germany" "Germany") ///
 varlabels(_cons Intercept)
 
  esttab  nocontrols_UnitedKingdom  controls_UnitedKingdom nocontrols_UnitedStates controls_UnitedStates nocontrols_US_2008 controls_US_2008 ///
  using TableInterestB.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Interest in Politics B)   nonumbers ///
 mtitles( "UK" "UK" "US 2016" "US 2016" "US 2012" "US 2012") ///
 varlabels(_cons Intercept)
 
 
 // Figure 1
coefplot (nocontrols_Canada, nokey)  (nocontrols_Denmark, nokey)  (nocontrols_France, nokey) (nocontrols_Germany, nokey)(nocontrols_UnitedKingdom, nokey) ///
(nocontrols_UnitedStates, nokey) (nocontrols_US_2008, nokey)  ///
 ,  drop(_cons) keep(disc) bylabel(Bivariate)  ///
 || (controls_Canada) (controls_Denmark) (controls_France) (controls_Germany) (controls_UnitedKingdom) ///
 (controls_UnitedStates) (controls_US_2008, nokey)  //////
 ,  drop(_cons) keep(disc) bylabel(Controls) ///
 || ,  xline(0,  lcolor(black)) labels  scheme (plottig) 
 
gr_edit plotregion1.yaxis1[1].add_ticks .62 `"Canada"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks .74 `"Denmark"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks .87 `"France"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1 `"Germany"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.12 `"United Kingdom"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.25 `"United States 2016"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.37 `"United States 2012"', tickset(major)

gr_edit plotregion1.yaxis1[1].major.delete_tick 1
gr_edit plotregion1.yaxis1[1].style.editstyle majorstyle(tickstyle(textstyle(size(medium)))) editcopy
gr_edit plotregion1.xaxis1[1].style.editstyle majorstyle(tickstyle(textstyle(size(medsmall)))) editcopy

graph export "Figure 1 - Interest.pdf", as(pdf) replace



/////////////////////////  Figure 2, Turnout 

eststo  clear

//Canada

quietly eststo nocontrols_Canada: reg vote_scale disc  if nonwhite==1 & country==0
quietly eststo controls_Canada: reg vote_scale disc age edu income imm woman if nonwhite==1  & country==0

//Denmark
quietly eststo nocontrols_Denmark:  reg  vote_scale disc if nonwhite==1  & country==1
 eststo controls_Denmark:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==1

//France
quietly eststo nocontrols_France:  reg  vote_scale disc if nonwhite==1  & country==4
quietly eststo controls_France: reg vote_scale disc age edu income imm woman if nonwhite==1  & country==4

//UK
quietly eststo nocontrols_UnitedKingdom:  reg vote_scale disc  if nonwhite==1 & country==3
quietly eststo controls_UnitedKingdom:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==3

//US
quietly eststo nocontrols_UnitedStates:  reg vote_scale disc  if nonwhite==1 & country==5
quietly eststo controls_UnitedStates:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==5

//US 2016
quietly eststo nocontrols_UnitedStates:  reg vote_scale disc  if nonwhite==1 & country==5
quietly eststo controls_UnitedStates:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==5

//US 2012
quietly eststo nocontrols_US_2012:  reg vote_scale disc  if nonwhite==1 & country==6
quietly eststo controls_US_2012:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==6

//US 2004
quietly eststo nocontrols_US_2004:  reg vote_scale disc  if nonwhite==1 & country==7
quietly eststo controls_US_2004:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==7


 esttab nocontrols_Canada controls_Canada  nocontrols_Denmark controls_Denmark nocontrols_France controls_France nocontrols_UnitedKingdom  controls_UnitedKingdom  ///
 using TableVoteA.tex, replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Turnout A)   nonumbers ///
 mtitles("Canada" "Canada"  "Denmark" "Denmark" "France" "France" "UK" "UK") ///
 varlabels(_cons Intercept)

  esttab   nocontrols_UnitedStates controls_UnitedStates nocontrols_US_2012 controls_US_2012 nocontrols_US_2004 controls_US_2004 ///
  using TableVoteB.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Turnout B)   nonumbers ///
 mtitles( "US 2016" "US 2016" "US 2012" "US 2012" "US 2004" "US 2004") ///
 varlabels(_cons Intercept)
 
 
 // Figure 2
 
coefplot (nocontrols_Canada, nokey)  (nocontrols_Denmark, nokey)  (nocontrols_France, nokey) (nocontrols_UnitedKingdom, nokey) ///
(nocontrols_UnitedStates, nokey)  (nocontrols_US_2012, nokey)  (nocontrols_US_2004, nokey) ///
 ,  drop(_cons) keep(disc) bylabel(Bivariate)  ///
 || (controls_Canada) (controls_Denmark) (controls_France)  (controls_UnitedKingdom) ///
 (controls_UnitedStates)  (controls_US_2012)  (controls_US_2004) ///
 ,  drop(_cons) keep(disc) bylabel(Controls) ///
 || ,  xline(0,  lcolor(black)) labels  scheme (plottig) 
 
gr_edit plotregion1.yaxis1[1].major.delete_tick 1
gr_edit plotregion1.yaxis1[1].add_ticks .62 `"Canada"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks .75 `"Denmark"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks .87 `"France"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1 `"United Kingdom"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.12 `"United States 2016"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.24 `"United States 2012"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.36 `"United States 2004"', tickset(major)

gr_edit plotregion1.yaxis1[1].style.editstyle majorstyle(tickstyle(textstyle(size(medium)))) editcopy
gr_edit plotregion1.xaxis1[1].style.editstyle majorstyle(tickstyle(textstyle(size(medsmall)))) editcopy

graph export "Figure 2 - Turnout.pdf", as(pdf) replace






////////////////////////Figure 3, Political Actions 

eststo  clear

//Canada

quietly eststo Nocontrols_Can: nbreg pol_action disc  if nonwhite==1 & country==0
margins, at((mean)_all disc=(0 1)) contrast(atcontrast(r)) post
est store nocontrols_Canada
quietly eststo controls_Can: nbreg pol_action disc age edu income imm woman if nonwhite==1 & country==0
margins, at((mean)_all disc=(0 1)) contrast(atcontrast(r)) post
est store controls_Canada

//UK
quietly eststo Nocontrols_UK: nbreg pol_action disc  if nonwhite==1 & country==3
margins, at((mean)_all disc=(0 1)) contrast(atcontrast(r)) post
est store nocontrols_UnitedKingdom
quietly eststo controls_UK: nbreg pol_action disc age edu income imm woman if nonwhite==1 & country==3
margins, at((mean)_all disc=(0 1)) contrast(atcontrast(r)) post
est store controls_UnitedKingdom

//U.S. 2016
quietly eststo Nocontrols_US: nbreg pol_action disc  if nonwhite==1 & country==5
margins, at((mean)_all disc=(0 1)) contrast(atcontrast(r)) post
est store nocontrols_UnitedStates
quietly eststo controls_US:  nbreg pol_action disc age edu income imm woman if nonwhite==1 & country==5
 margins, at((mean)_all disc=(0 1)) contrast(atcontrast(r)) post
est store controls_UnitedStates


//U.S. 2004
quietly eststo Nocontrols_US_2004: nbreg pol_action disc  if nonwhite==1 & country==7
margins, at((mean)_all disc=(0 1)) contrast(atcontrast(r)) post
est store nocontrols_US_2004
quietly eststo Controls_US_2004:  nbreg pol_action disc age edu income imm woman if nonwhite==1 & country==7
 margins, at((mean)_all disc=(0 1)) contrast(atcontrast(r)) post
est store controls_US_2004

//Table   
esttab Nocontrols_Can controls_Can Nocontrols_UK controls_UK Nocontrols_US controls_US Nocontrols_US_2004 Controls_US_2004 ///
  using Actions.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Political Actions)   nonumbers ///
 mtitles("Canada" "Canada" "UK" "UK" "US 2016" "US 2016" "US 2012" "US 2012") ///
 varlabels(_cons Intercept)
 

//Figure 3
coefplot (nocontrols_Canada, nokey)  (nocontrols_UnitedKingdom, nokey) ///
(nocontrols_UnitedStates, nokey) (nocontrols_US_2004, nokey)  , bylabel(Bivariate) ///
|| (controls_Canada)   (controls_UnitedKingdom) ///
(controls_UnitedStates) (controls_US_2004), bylabel(Controls)   ///
|| ,  xline(0,  lcolor(black))   scheme (plottig) 

gr_edit plotregion1.yaxis1[1].major.delete_tick 1
gr_edit plotregion1.yaxis1[1].add_ticks .70 `"Canada"', tickset(major)
gr_edit plotregion1.yaxis1[1].major.num_rule_ticks = 0
gr_edit plotregion1.yaxis1[1].add_ticks .9 `"United Kingdom"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.1 `"United States 2016"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.3 `"United States 2004"', tickset(major)
gr_edit plotregion1.yaxis1[1].style.editstyle majorstyle(tickstyle(textstyle(size(medium)))) editcopy
gr_edit plotregion1.xaxis1[1].style.editstyle majorstyle(tickstyle(textstyle(size(medsmall)))) editcopy
 
graph export "Figure 3 - Actions.pdf", as(pdf) replace
 
 
 
 //////////////////////// Figure 4, Political and Social Discrimination 

eststo  clear


//Germany
quietly eststo int_Nocontrols_Ger: reg interest disc_social disc_gov  if nonwhite==1  & country==2
estimates store ger_int
quietly eststo int_controls_Ger: reg interest disc_social disc_gov   age edu income imm woman if nonwhite==1  & country==2
estimates store ger_int_controls

//Denmark
quietly eststo int_Nocontrols_Den: reg  interest disc_social disc_gov  if nonwhite==1  & country==1
estimates store den_int
quietly eststo int_controls_Den: reg  interest disc_social disc_gov   age edu income imm woman if nonwhite==1  & country==1
estimates store den_int_controls

quietly eststo vote_Nocontrols_Den: reg  vote_scale disc_social disc_gov if nonwhite==1  & country==1
estimates store den_vote
quietly eststo vote_controls_Den: reg  vote_scale disc_social disc_gov  age edu income imm woman if nonwhite==1  & country==1
estimates store den_vote_controls

//Canada
quietly eststo int_Nocontrols_Can: reg interest disc_social disc_gov if nonwhite==1  & country==0
estimates store can_int
quietly eststo int_controls_Can: reg interest  disc_social disc_gov  age edu income imm woman if nonwhite==1  & country==0
estimates store can_int_controls

quietly eststo vote_Nocontrols_Can: reg vote_scale disc_social disc_gov if nonwhite==1  & country==0
estimates store can_vote
quietly eststo vote_controls_Can: reg vote_scale disc_social disc_gov age edu income imm woman if nonwhite==1  & country==0
estimates store can_vote_controls

quietly eststo Action_Nocontrols_Can: nbreg pol_action disc_social disc_gov if nonwhite==1  & country==0
estimates store can_act
quietly eststo Action_controls_Can: nbreg pol_action  disc_social disc_gov  age edu income imm woman if nonwhite==1  & country==0
estimates store can_act_controls

//UK
quietly eststo int_Nocontrols_UK: reg interest disc_social disc_gov   if nonwhite==1  & country==3
estimates store uk_int
quietly eststo int_controls_UK: reg interest disc_social disc_gov  age edu income imm woman if nonwhite==1  & country==3
estimates store uk_int_controls

quietly eststo vote_Nocontrols_UK: reg vote_scale disc_social disc_gov  if nonwhite==1  & country==3
estimates store uk_vote
quietly eststo vote_controls_UK: reg vote_scale disc_social disc_gov   age edu income imm woman if nonwhite==1  & country==3
estimates store uk_vote_controls

quietly eststo Action_Nocontrols_UK: nbreg pol_action disc_social disc_gov  if nonwhite==1  & country==3
est store uk_act
quietly eststo Action_controls_UK:   nbreg scale_act disc_social disc_gov  age edu income imm woman if nonwhite==1  & country==3
est store uk_act_controls


///////////////////// Political and Social with controls and bivariate, for appendix


coefplot (can_act) (uk_act, msymbol(D)) ,  keep( disc_social disc_gov)  xline(0,  lcolor(black)) bylabel(Bivariate - Actions) ///
name (act_bi, replace)  nodraw  scheme (plottig) title(Political Actions - Bivariate)   xlabel(0(0.5)1.5) xscale(range(-0.1(0.1)1.5))

coefplot can_act_controls uk_act_controls , keep( disc_social disc_gov )  xline(0,  lcolor(black))  bylabel(Bivariate - Actions) ///
name (act_multi, replace) nodraw  scheme (plottig) title(Political Actions - Controls) xlabel(0(0.5)1.5) xscale(range(-0.1(0.1)1.5))

coefplot  can_vote  (uk_vote, msymbol(D)) (den_vote, msymbol(T)), keep( disc_social disc_gov )  xline(0,  lcolor(black))  bylabel(Bivariate - Actions) ///
name (vote_bi, replace) nodraw scheme (plottig) title(Turnout - Bivariate)

coefplot can_vote_controls  (uk_vote_controls, msymbol(D)) (den_vote_controls, msymbol(T))  , keep( disc_social disc_gov ) xline(0,  lcolor(black))bylabel(Bivariate - Actions) ///
name (vote_multi, replace) nodraw   scheme (plottig)  title(Turnout - Controls)

coefplot can_int (uk_int, msymbol(D)) (den_int, msymbol(T))  (ger_int, msymbol(Sh))  , keep( disc_social disc_gov )  xline(0,  lcolor(black))  bylabel(Bivariate - Actions) ///
name (int_bi, replace) nodraw    scheme (plottig) title(Interest - Bivariate) legend( order(2 "Canada" 4 "United Kingdom" 6 "Denmark" 8 "Germany"))

coefplot can_int_controls (int_controls_UK, msymbol(D)) (den_int_controls, msymbol(T)) (ger_int_controls, msymbol(Sh))   , keep( disc_social disc_gov ) xline(0,  lcolor(black))  bylabel(Bivariate - Actions) ///
name (int_multi, replace)  nodraw  scheme (plottig)  title(Interest - Controls) 


grc1leg2 int_bi vote_bi act_bi int_multi  vote_multi act_multi,  col(3)   scheme (plottig) lcols(2)

graph export "Figure 4 - Gov and Social controls and bivariate.pdf", as(pdf) replace


///////////////////// Political and Social with just controls for main text

coefplot can_act_controls uk_act_controls , keep( disc_social disc_gov )  xline(0,  lcolor(black))  bylabel(Bivariate - Actions) ///
name (act_multi, replace) nodraw  scheme (plottig) title(Political Actions, size(medium)) xlabel(0(0.5)1.5, labsize(medium)) ylabel(, labsize(medium)) xscale(range(-0.1(0.1)1.5))

coefplot can_vote_controls  (uk_vote_controls, msymbol(D)) (den_vote_controls, msymbol(T))  , keep( disc_social disc_gov ) xline(0,  lcolor(black))bylabel(Bivariate - Actions) ///
name (vote_multi, replace)  nodraw  scheme (plottig)  title(Turnout, size(medium)) xlabel(, labsize(medium)) ylabel(, labsize(medium))

coefplot can_int_controls (int_controls_UK, msymbol(D)) (den_int_controls, msymbol(T)) (ger_int_controls, msymbol(Sh))   , keep( disc_social disc_gov ) xline(0,  lcolor(black))  bylabel(Bivariate - Actions) ///
name (int_multi, replace)  nodraw  scheme (plottig)  title(Interest, size(medium))  xlabel(, labsize(medium)) ylabel(, labsize(medium)) ///
legend( order(2 "Canada" 4 "United Kingdom" 6 "Denmark" 8 "Germany"))

grc1leg2 int_multi  vote_multi act_multi,  col(3)   scheme (plottig) lcols(2)

graph export "Figure 4 - Government and Social.pdf", as(pdf) replace


/////// Tables for political and social discrimination

esttab int_Nocontrols_Can int_controls_Can  int_Nocontrols_Den int_controls_Den  int_Nocontrols_Ger int_controls_Ger int_Nocontrols_UK int_controls_UK ///
 using GovSocialInterest.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Political and Social Discrimination - Interest)   nonumbers ///
 mtitles("Canada" "Canada"  "Denmark" "Denmark" "Germany" "Germany" "UK" "UK") ///
 varlabels(_cons Intercept)
 
 esttab vote_Nocontrols_Can  vote_controls_Can vote_Nocontrols_Den vote_controls_Den    vote_Nocontrols_UK vote_controls_UK ///
 using GovSocialVote.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Political and Social Discrimination - Turnout)   nonumbers ///
 mtitles("Canada" "Canada"  "Denmark" "Denmark" "UK" "UK") ///
 varlabels(_cons Intercept)
 
  esttab   Action_Nocontrols_Can  Action_controls_Can Action_Nocontrols_UK Action_controls_UK ///
 using GovSocialAction.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Political and Social Discrimination - Political Actions)   nonumbers ///
 mtitles("Canada" "Canada"   "UK" "UK") ///
 varlabels(_cons Intercept)

 
 
 
 
 
 /////////////////////////////////////////////////////// Appendix
 
 
 
 ////////////////////////////////Ethnic groups
 ///////////////Interest
 
eststo  clear

//France
 eststo France_asian: reg interest disc age edu income imm woman if nonwhite==1  & country==4 & ethnicFr==1
 eststo France_african: reg interest disc age edu income imm woman if nonwhite==1  & country==4 & ethnicFr==2
 eststo France_arab: reg interest disc age edu income imm woman if nonwhite==1  & country==4 & ethnicFr==4

//UK
 eststo UK_asian:  reg interest disc age edu income imm woman if nonwhite==1  & country==3 & ethnicUK==1
 eststo UK_black:  reg interest disc age edu income imm woman if nonwhite==1  & country==3 & ethnicUK==2

//US
 eststo  US2016_hispanic:  reg interest disc age edu income imm woman if nonwhite==1  & country==5 & ethnicUS2016==1
 eststo US2016_black:  reg interest disc age edu income imm woman if nonwhite==1  & country==5 & ethnicUS2016==2
 eststo US2016_asian:  reg interest disc age edu income imm woman if nonwhite==1  & country==5 & ethnicUS2016==3

 eststo US2012_black:  reg interest disc age edu income imm woman if nonwhite==1  & country==6 & ethnicUS2012==1
 eststo US2012_other:  reg interest disc age edu income imm woman if nonwhite==1  & country==6 & ethnicUS2012==2
 eststo US2012_hispanic:  reg interest disc age edu income imm woman if nonwhite==1  & country==6 & ethnicUS2012==3


// Table
 esttab US2016_black US2012_black US2016_hispanic US2012_hispanic US2016_asian  US2012_other   ///
 using TableEthnicInterestA.tex , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Interest - Ethnnoracial Groups A)   nonumbers ///
 mtitles("US 2016 Black" "US 2012 Black"  "US 2016 Hispanic" "US 2012 Hispanic" "US 2016 Asian" "US 2012 Other") ///
 varlabels(_cons Intercept)
 
  esttab  France_asian France_african  France_arab  UK_black UK_asian ///
  using TableEthnicInterestB.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Interest - Ethnnoracial Groups B)   nonumbers ///
 mtitles( "France Asian" "France African""France MENA" "UK Black" "UK Asian") ///
 varlabels(_cons Intercept)
 
 
  ///////////////Ethnic groups Turnout
 
eststo  clear

//France
 eststo France_asian: reg vote_scale disc age edu income imm woman if nonwhite==1  & country==4 & ethnicFr==1
 eststo France_african: reg vote_scale disc age edu income imm woman if nonwhite==1  & country==4 & ethnicFr==2
 eststo France_arab: reg vote_scale disc age edu income imm woman if nonwhite==1  & country==4 & ethnicFr==4

//UK
 eststo UK_asian:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==3 & ethnicUK==1
 eststo UK_black:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==3 & ethnicUK==2

 eststo  US2016_hispanic:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==5 & ethnicUS2016==1
//US
 eststo US2016_black:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==5 & ethnicUS2016==2
 eststo US2016_asian:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==5 & ethnicUS2016==3
 
  eststo US2012_black:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==6 & ethnicUS2012==1
 eststo US2012_other:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==6 & ethnicUS2012==2
 eststo US2012_hispanic:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==6 & ethnicUS2012==3


 eststo US2004_black:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==7 & ethnicUS2004==1
 eststo US2004_asian:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==7 & ethnicUS2004==2
 eststo US2004_hispanic:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==7 & ethnicUS2004==3
 eststo US2004_caribbean:  reg vote_scale disc age edu income imm woman if nonwhite==1  & country==7 & ethnicUS2004==4


// Table ethnic groups vote
 esttab US2016_black US2016_hispanic US2016_asian US2012_hispanic US2012_black US2012_other US2004_black    US2004_hispanic    US2004_asian    ///
 using TableEthnicInterestA.tex , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Turnout - Ethnnoracial Groups A)   nonumbers ///
 mtitles("US 2016 Black"  "US 2016 Hispanic" "US 2016 Asian"  "US 2012 Black"  "US 2012 Hispanic" "US 2012 Other" "US 2004 Black"  "US 2004 Hispanic"  "US 2004 Asian" ) ///
 varlabels(_cons Intercept)
 
  esttab  France_asian France_african  France_arab  UK_black UK_asian ///
  using TableEthnicInterestB.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Interest - Ethnnoracial Groups B)   nonumbers ///
 mtitles( "France Asian" "France African""France MENA" "UK Black" "UK Asian") ///
 varlabels(_cons Intercept)
 
 

  ///////////////Ethnic groups Political Action
 
eststo  clear

//UK
 eststo UK_asian:  reg pol_action disc age edu income imm woman if nonwhite==1  & country==3 & ethnicUK==1
 eststo UK_black:  reg pol_action disc age edu income imm woman if nonwhite==1  & country==3 & ethnicUK==2

//US
 eststo  US2016_hispanic:  reg pol_action disc age edu income imm woman if nonwhite==1  & country==5 & ethnicUS2016==1
 eststo US2016_black:  reg pol_action disc age edu income imm woman if nonwhite==1  & country==5 & ethnicUS2016==2
 eststo US2016_asian:  reg pol_action disc age edu income imm woman if nonwhite==1  & country==5 & ethnicUS2016==3

 eststo US2004_black:  reg pol_action disc age edu income imm woman if nonwhite==1  & country==7 & ethnicUS2004==1
 eststo US2004_asian:  reg pol_action disc age edu income imm woman if nonwhite==1  & country==7 & ethnicUS2004==2
 eststo US2004_hispanic:  reg pol_action disc age edu income imm woman if nonwhite==1  & country==7 & ethnicUS2004==3


// Table ethnic groups vote
 esttab US2016_black US2016_hispanic US2016_asian US2004_black US2004_hispanic    US2004_asian  UK_black UK_asian  ///
 using TableEthnicTurnoutrtf , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Political Actions - Ethnnoracial Groups)   nonumbers ///
 mtitles("US 2016 Black"  "US 2016 Hispanic" "US 2016 Asian" "US 2004 Black"  "US 2004 Hispanic"  "US 2004 Asian" "UK Black" "UK Asian" ) ///
 varlabels(_cons Intercept)

 
 
 
  //////////////////////////////// Correlates of discrimination
 
eststo  clear

//Canada

quietly eststo controls_Canada: reg disc age edu income imm woman if nonwhite==1  & country==0

//Denmark
 eststo controls_Denmark:  reg  disc age edu income imm woman if nonwhite==1  & country==1

//France
quietly eststo controls_France: reg  disc age edu income imm woman if nonwhite==1  & country==4

//Germany
 eststo controls_Germany: reg  disc age edu income imm woman if nonwhite==1  & country==2

//UK
quietly eststo controls_UnitedKingdom:  reg  disc age edu income imm woman if nonwhite==1  & country==3

//US
quietly eststo controls_UnitedStates:  reg  disc age edu income imm woman if nonwhite==1  & country==5

quietly eststo controls_US_2012:  reg  disc age edu income imm woman if nonwhite==1  & country==6

quietly eststo controls_US_2004:  reg  disc age edu income imm woman if nonwhite==1  & country==7


// Table
 
 esttab  controls_Canada   controls_Denmark  controls_France  controls_Germany controls_UnitedKingdom  controls_UnitedStates  controls_US_2012 controls_US_2004  ///
 using CorrelatesA.tex, replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Interest in Politics A)   nonumbers ///
 mtitles("Canada" "Denmark" "France"  "Germany") ///
 varlabels(_cons Intercept)
 
  esttab    controls_UnitedKingdom  controls_UnitedStates  controls_US_2012 controls_US_2004 ///
  using CorrelatesB.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Interest in Politics B)   nonumbers ///
 mtitles( "UK" "UK" "US 2016" "US 2012" "US 2004") ///
 varlabels(_cons Intercept)
 
 
 

 
/////////////////////////  Two types of discrimination scale


quietly eststo gen_Canada: reg interest disc_general age edu income imm woman if nonwhite==1  & country==0
quietly eststo gen_France: reg interest disc_general age edu income imm woman if nonwhite==1  & country==3
quietly eststo gen_UK: reg interest disc_general age edu income imm woman if nonwhite==1  & country==4
quietly eststo gen_US: reg interest disc_general age edu income imm woman if nonwhite==1  & country==5

coefplot  (gen_Canada) (gen_France)  (gen_UK) (gen_US) ///
,  drop(_cons) keep(disc_general) title(General Discrimination) ///
|| ,  xline(0,  lcolor(black)) labels  scheme (plottig) legend(off)

gr_edit yaxis1.major.delete_tick 1
gr_edit yaxis1.add_ticks .70 `"Canada"', tickset(major)
gr_edit yaxis1.add_ticks .90 `"France"', tickset(major)
gr_edit yaxis1.add_ticks 1.1 `"United Kingdom"', tickset(major)
gr_edit yaxis1.add_ticks 1.30 `"United States"', tickset(major)
gr_edit yaxis1.style.editstyle majorstyle(tickstyle(textstyle(size(medium)))) editcopy
gr_edit yaxis1.style.editstyle majorstyle(tickstyle(textstyle(size(medsmall)))) editcopy
gr_edit xaxis1.reset_rule 0 .14 .02 , tickset(major) ruletype(range) 


graph save "general discrimination", replace


quietly eststo spec_Canada: reg interest disc_scale age edu income imm woman if nonwhite==1  & country==0
quietly eststo spec_Denmark: reg interest disc_scale age edu income imm woman if nonwhite==1  & country==1
quietly eststo spec_Germany: reg interest disc_scale age edu income imm woman if nonwhite==1  & country==2
quietly eststo spec_UK: reg interest disc_scale age edu income imm woman if nonwhite==1  & country==3

coefplot  (spec_Canada) (spec_Denmark)  (spec_Germany) (spec_UK) ///
,  drop(_cons) keep(disc_scale) title(Specific Discrimination) ///
|| ,  xline(0,  lcolor(black)) labels  scheme (plottig) legend(off)

gr_edit yaxis1.major.delete_tick 1
gr_edit yaxis1.add_ticks .70 `"Canada"', tickset(major)
gr_edit yaxis1.add_ticks .90 `"Denmark"', tickset(major)
gr_edit yaxis1.add_ticks 1.1 `"Germany"', tickset(major)
gr_edit yaxis1.add_ticks 1.30 `"United Kingdom"', tickset(major)
gr_edit yaxis1.style.editstyle majorstyle(tickstyle(textstyle(size(medium)))) editcopy
gr_edit yaxis1.style.editstyle majorstyle(tickstyle(textstyle(size(medsmall)))) editcopy

graph save "specific discrimination", replace

gr combine "general discrimination" "specific discrimination",  ysize(5) xsize(10) imargin()  graphregion(fcolor(white)) 

graph export "Turnout higher-lower order.pdf", as(pdf) replace


 
/////////////////////////  Higher and Lower order turnout

eststo  clear

//Canada

quietly eststo nocontrols_Canada: logit vote_nat disc  if nonwhite==1 & country==0
quietly eststo controls_Canada: logit vote_nat disc age edu income imm woman if nonwhite==1  & country==0

//Denmark
quietly eststo nocontrols_Denmark:  logit  vote_nat disc if nonwhite==1  & country==1
 eststo controls_Denmark:  logit vote_nat disc age edu income imm woman if nonwhite==1  & country==1

//France
quietly eststo nocontrols_France:  logit  vote_nat disc if nonwhite==1  & country==4
quietly eststo controls_France: logit vote_nat disc age edu income imm woman if nonwhite==1  & country==4

//UK
quietly eststo nocontrols_UnitedKingdom:  logit vote_nat disc  if nonwhite==1 & country==3
quietly eststo controls_UnitedKingdom:  logit vote_nat disc age edu income imm woman if nonwhite==1  & country==3

//US
quietly eststo nocontrols_UnitedStates:  logit vote_nat disc  if nonwhite==1 & country==5
quietly eststo controls_UnitedStates:  logit vote_nat disc age edu income imm woman if nonwhite==1  & country==5

//US
quietly eststo nocontrols_UnitedStates:  logit vote_nat disc  if nonwhite==1 & country==5
quietly eststo controls_UnitedStates:  logit vote_nat disc age edu income imm woman if nonwhite==1  & country==5

//US
quietly eststo nocontrols_UnitedStates:  logit vote_nat disc  if nonwhite==1 & country==5
quietly eststo controls_UnitedStates:  logit vote_nat disc age edu income imm woman if nonwhite==1  & country==5



 esttab  controls_Canada     controls_France controls_UnitedKingdom  controls_UnitedStates  ///
 using TableHighOrder.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title (Higher Order Turnout\label{tabNatA})   nonumbers ///
 mtitles("Canada" "Canada" "France" "France" "UK" "UK" "US" "US") ///
 varlabels(_cons Intercept)

 
 
 // Higher order turnout 

coefplot  (controls_Canada) (controls_France)  (controls_UnitedKingdom) (controls_UnitedStates) ///
 ,  drop(_cons) keep(disc) bylabel(1st Order) ///
 || ,  xline(0,  lcolor(black)) labels  scheme (plottig) legend(off)

gr_edit yaxis1.major.delete_tick 1
gr_edit yaxis1.add_ticks .70 `"Canada Federal"', tickset(major)
gr_edit yaxis1.add_ticks .90 `"France 2nd Round Pres"', tickset(major)
gr_edit yaxis1.add_ticks 1.1 `"UK Parliment"', tickset(major)
gr_edit yaxis1.add_ticks 1.30 `"US Presidential"', tickset(major)
gr_edit yaxis1.style.editstyle majorstyle(tickstyle(textstyle(size(medium)))) editcopy
gr_edit yaxis1.style.editstyle majorstyle(tickstyle(textstyle(size(medsmall)))) editcopy

graph save "higher order",  replace



 
/////////////////////////  Lower order turnout


//Canada

quietly eststo muni_Canada: reg vote_muni disc age edu income imm woman if nonwhite==1  & country==0
quietly eststo prov_Canada: reg vote_prov disc age edu income imm woman if nonwhite==1  & country==0

//France
quietly eststo muni_France:  reg  vote_muni disc age edu income imm woman if nonwhite==1  & country==4
quietly eststo first_France: reg vote_pres1 disc age edu income imm woman if nonwhite==1  & country==4

//UK
quietly eststo local_UnitedKingdom:  reg vote_loc10 disc age edu income imm woman if nonwhite==1  & country==3

//US
quietly eststo cong_UnitedStates:  reg vote_state disc age edu income imm woman  if nonwhite==1 & country==5
quietly eststo state_UnitedStates:  reg vote_cong disc age edu income imm woman  if nonwhite==1 & country==6



 esttab  muni_Canada prov_Canada muni_France first_France local_UnitedKingdom cong_UnitedStates state_UnitedStates  ///
 using TableLowerOrder.tex, replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Lower Order Turnout)   nonumbers ///
 mtitles("Canada Muni" "Canada Prov"  "France Muni" "France 1st Pres" "UK Local" "US Congress" "US State/Local") ///
 varlabels(_cons Intercept)


 
 // Figure 
coefplot (muni_Canada, nokey)  (prov_Canada, nokey)  (muni_France, nokey) (first_France, nokey) ///
(local_UnitedKingdom, nokey)  (cong_UnitedStates, nokey)  (state_UnitedStates, nokey) ///
 ,  drop(_cons) keep(disc) bylabel(Bivariate)  ///
 || ,  xline(0,  lcolor(black)) labels  scheme (plottig) 
 

gr_edit yaxis1.major.delete_tick 1
gr_edit yaxis1.add_ticks .62 `"Canada Municipal"', tickset(major)
gr_edit yaxis1.add_ticks .75 `"Canada Provincial"', tickset(major)
gr_edit yaxis1.add_ticks .87 `"France Municipal"', tickset(major)
gr_edit yaxis1.add_ticks 1 `"France 1st Round Pres"', tickset(major)
gr_edit yaxis1.add_ticks 1.12 `"UK Local"', tickset(major)
gr_edit yaxis1.add_ticks 1.24 `"US Congress"', tickset(major)
gr_edit yaxis1.add_ticks 1.36 `"US State/Local"', tickset(major)

gr_edit yaxis1.style.editstyle majorstyle(tickstyle(textstyle(size(medium)))) editcopy
gr_edit yaxis1.style.editstyle majorstyle(tickstyle(textstyle(size(medsmall)))) editcopy

graph save "lower order", replace

gr combine "higher order" "lower order",  ysize(5) xsize(10) imargin()  graphregion(fcolor(white)) 

graph export "Turnout higher-lower order.pdf", as(pdf) replace



///////////////////////////////////// Additional controls
eststo  clear

//Canada

quietly eststo nocontrols_Canada: reg vote_scale disc  if nonwhite==1 & country==0
quietly eststo controls_Canada: reg vote_scale disc age edu income imm woman  interest  partisan  trust if nonwhite==1  & country==0

//UK
quietly eststo nocontrols_UnitedKingdom:  reg vote_scale disc  if nonwhite==1 & country==3
quietly eststo controls_UnitedKingdom:  reg vote_scale disc age edu income imm woman  interest  partisan trust efficacy i.ethnicUK if nonwhite==1  & country==3

//US
quietly eststo nocontrols_UnitedStates:  reg vote_scale disc  if nonwhite==1 & country==5
quietly eststo controls_UnitedStates:  reg vote_scale disc age edu income imm woman  interest  partisan trust efficacy i.ethnicUS2016 if nonwhite==1  & country==5


esttab nocontrols_Canada controls_Canada  nocontrols_UnitedKingdom  controls_UnitedKingdom nocontrols_UnitedStates controls_UnitedStates  using TableMoreControls.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label   nonumbers title(Additional Controls\label{tabMoreControls}) ///
 mtitles("Canada" "Canada"  "UK" "UK" "US" "US") ///
 varlabels(_cons Intercept)



coefplot (nocontrols_Canada, nokey)  (nocontrols_UnitedKingdom, nokey) (nocontrols_UnitedStates, nokey) ///
 ,  drop(_cons) keep(disc) bylabel(Bivariate)  ///
 || (controls_Canada)   (controls_UnitedKingdom) (controls_UnitedStates) ///
 ,  drop(_cons) keep(disc) bylabel(Controls) ///
 || ,  xline(0,  lcolor(black)) labels  scheme (plottig) 
 
gr_edit plotregion1.yaxis1[1].add_ticks .75 `"Canada"', tickset(major)
gr_edit plotregion1.yaxis1[1].major.num_rule_ticks = 0
gr_edit plotregion1.yaxis1[1].edit_tick 1 1 `"United Kingdom"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.25 `"United States"', tickset(major)
gr_edit plotregion1.yaxis1[1].style.editstyle majorstyle(tickstyle(textstyle(size(medium)))) editcopy
gr_edit plotregion1.xaxis1[1].style.editstyle majorstyle(tickstyle(textstyle(size(medsmall)))) editcopy
 
graph export "More Controls.pdf", as(pdf) replace




//////////////////// Interest Citizens only

eststo  clear

//Canada
 eststo nocontrols_Canada: reg interest disc  if nonwhite==1 & country==0 & citizen==1
quietly eststo controls_Canada: reg interest disc age edu income imm woman if nonwhite==1  & country==0 & citizen==1

//Denmark
 eststo nocontrols_Denmark:  reg  interest disc if nonwhite==1  & country==1 
 eststo controls_Denmark:  reg interest disc age edu income imm woman if nonwhite==1  & country==1 

//France
 eststo nocontrols_France:  reg  interest disc if nonwhite==1  & country==4 & citizen==1
 eststo controls_France: reg interest disc age edu income imm woman if nonwhite==1  & country==4 & citizen==1

//Germany
 eststo nocontrols_Germany: reg interest disc  if nonwhite==1 & country==2 & citizen==1
 eststo controls_Germany: reg interest disc age edu income imm woman if nonwhite==1  & country==2 & citizen==1

//UK
 eststo nocontrols_UnitedKingdom:  reg interest disc  if nonwhite==1 & country==3 & citizen==1
quietly eststo controls_UnitedKingdom:  reg interest disc age edu income imm woman if nonwhite==1  & country==3 & citizen==1

//US
 eststo nocontrols_UnitedStates:  reg interest disc  if nonwhite==1 & country==5 & citizen==1
 eststo controls_UnitedStates:  reg interest disc age edu income imm woman if nonwhite==1  & country==5 & citizen==1


// Table

 esttab nocontrols_Canada controls_Canada  nocontrols_Denmark controls_Denmark nocontrols_France controls_France   ///
 using TableCitizenA.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Interest in Politics A\label{tabInterestA})   nonumbers ///
 mtitles("Canada" "Canada"  "Denmark" "Denmark" "France" "France") ///
 varlabels(_cons Intercept)
 
  esttab nocontrols_Germany controls_Germany nocontrols_UnitedKingdom  controls_UnitedKingdom nocontrols_UnitedStates controls_UnitedStates ///
  using TableCitizenB.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Interest in Politics B\label{tabInterestB})   nonumbers ///
 mtitles("Germany"  "Germany" "UK" "UK" "US" "US") ///
 varlabels(_cons Intercept)
 
   esttab nocontrols_Germany controls_Germany nocontrols_UnitedKingdom  controls_UnitedKingdom nocontrols_UnitedStates controls_UnitedStates ///
  using TableCitizenB.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Interest in Politics B\label{tabInterestB})   nonumbers ///
 mtitles("Germany"  "Germany" "UK" "UK" "US" "US") ///
 varlabels(_cons Intercept)
 
 // Figure 
coefplot (nocontrols_Canada, nokey)  (nocontrols_Denmark, nokey)  (nocontrols_France, nokey) (nocontrols_Germany, nokey)(nocontrols_UnitedKingdom, nokey) (nocontrols_UnitedStates, nokey) ///
 ,  drop(_cons) keep(disc) bylabel(Bivariate)  ///
 || (controls_Canada) (controls_Denmark) (controls_France) (controls_Germany) (controls_UnitedKingdom) (controls_UnitedStates) ///
 ,  drop(_cons) keep(disc) bylabel(Controls) ///
 || ,  xline(0,  lcolor(black)) labels  scheme (plottig) 
 
gr_edit plotregion1.yaxis1[1].add_ticks .64 `"Canada"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks .78 `"Denmark"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks .93 `"France"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.07 `"Germany"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.22 `"United Kingdom"', tickset(major)
gr_edit plotregion1.yaxis1[1].add_ticks 1.36 `"United States"', tickset(major)
gr_edit plotregion1.yaxis1[1].major.delete_tick 1
gr_edit plotregion1.yaxis1[1].style.editstyle majorstyle(tickstyle(textstyle(size(medium)))) editcopy
gr_edit plotregion1.xaxis1[1].style.editstyle majorstyle(tickstyle(textstyle(size(medsmall)))) editcopy

graph export "Interest Citizens.pdf", as(pdf) replace




//////////////////////////////////// Specific Actions


/////////////////////// Specific Action  General Discrimination

eststo  clear

//Canada
quietly eststo protest_Nocontrols_Can: logit act_protest disc if nonwhite==1  & country==0
quietly eststo protest_controls_Can: logit act_protest  disc  age edu income imm woman if nonwhite==1  & country==0

quietly eststo boycott_Nocontrols_Can: logit act_boycott disc if nonwhite==1  & country==0
quietly eststo boycott_controls_Can: logit act_boycott disc age edu income imm woman if nonwhite==1  & country==0

quietly eststo petition_Nocontrols_Can: logit act_petition disc if nonwhite==1  & country==0
quietly eststo petition_controls_Can: logit act_petition  disc  age edu income imm woman if nonwhite==1  & country==0

quietly eststo contact_Nocontrols_Can: logit act_contact disc if nonwhite==1  & country==0
quietly eststo contact_controls_Can: logit act_contact disc  age edu income imm woman if nonwhite==1  & country==0

 esttab protest_Nocontrols_Can protest_controls_Can boycott_Nocontrols_Can boycott_controls_Can petition_Nocontrols_Can contact_controls_Can  ///
 using SpecificActionsCan.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Canada - Specific Actions\label{tabSpecificActionsCan})  nonumbers ///
 mtitles("Protest" "Protest" "Boycott" "Boycott" "Petition" "Petition" "Contact" "Contact" ) eqlabels(" " " ") ///
 varlabels(_cons Intercept) 
 
 //UK
quietly eststo protest_Nocontrols_UK: logit act_protest disc if nonwhite==1  & country==3
quietly eststo protest_controls_UK: logit act_protest  disc  age edu income imm woman if nonwhite==1  & country==3

quietly eststo boycott_Nocontrols_UK: logit act_boycott disc if nonwhite==1  & country==3
quietly eststo boycott_controls_UK: logit act_boycott disc age edu income imm woman if nonwhite==1  & country==3

quietly eststo petition_Nocontrols_UK: logit act_petition disc if nonwhite==1  & country==3
quietly eststo petition_controls_UK: logit act_petition  disc  age edu income imm woman if nonwhite==1  & country==3

quietly eststo donate_Nocontrols_UK: logit act_given disc if nonwhite==1  & country==3
quietly eststo donate_controls_UK: logit act_given disc  age edu income imm woman if nonwhite==1  & country==3

 esttab protest_Nocontrols_UK protest_controls_UK boycott_Nocontrols_UK boycott_controls_UK petition_Nocontrols_UK petition_controls_UK donate_Nocontrols_UK donate_controls_UK  ///
 using SpecificActionsUK.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(UK - Specific Actions\label{tabSpecificActionsUK})   nonumbers ///
 mtitles("Protest" "Protest" "Boycott" "Boycott" "Petition" "Petition" "Donate" "Donate" ) eqlabels(" " " ") ///
 varlabels(_cons Intercept)
 
 
  //US
quietly eststo protest_Nocontrols_US: logit act_protest disc if nonwhite==1  & country==5
quietly eststo protest_controls_US: logit act_protest  disc  age edu income imm woman if nonwhite==1  & country==5

quietly eststo boycott_Nocontrols_US: logit act_boycott disc if nonwhite==1  & country==5
quietly eststo boycott_controls_US: logit act_boycott disc age edu income imm woman if nonwhite==1  & country==5

quietly eststo petition_Nocontrols_US: logit act_petition disc if nonwhite==1  & country==5
quietly eststo petition_controls_US: logit act_petition  disc  age edu income imm woman if nonwhite==1  & country==5

quietly eststo contact_Nocontrols_US: logit act_contact disc if nonwhite==1  & country==5
quietly eststo contact_controls_US: logit act_contact disc  age edu income imm woman if nonwhite==1  & country==5

quietly eststo donate_Nocontrols_US: logit act_money disc if nonwhite==1  & country==5
quietly eststo donate_controls_US: logit act_money disc  age edu income imm woman if nonwhite==1  & country==5

 esttab protest_Nocontrols_US protest_controls_US boycott_Nocontrols_US boycott_controls_US petition_Nocontrols_US petition_controls_US ///
 contact_Nocontrols_US contact_controls_US donate_Nocontrols_US donate_controls_US  ///
 using SpecificActionsUS.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(US - Specific Actions\label{tabSpecificActionsUS})   nonumbers ///
 mtitles("Protest" "Protest" "Boycott" "Boycott" "Petition" "Petition" "Contact" "Contact" "Donate" "Donate" ) eqlabels(" " " ") ///
 varlabels(_cons Intercept)
 

////////////// Specific Actions Gov and Social Discrimination
  
//Canada
quietly eststo protest_Nocontrols_Can: logit act_protest disc_social disc_gov if nonwhite==1  & country==0
quietly eststo protest_controls_Can: logit act_protest  disc_social disc_gov  age edu income imm woman if nonwhite==1  & country==0

quietly eststo boycott_Nocontrols_Can: logit act_boycott disc_social disc_gov if nonwhite==1  & country==0
quietly eststo boycott_controls_Can: logit act_boycott disc_social disc_gov age edu income imm woman if nonwhite==1  & country==0

quietly eststo petition_Nocontrols_Can: logit act_petition disc_social disc_gov if nonwhite==1  & country==0
quietly eststo petition_controls_Can: logit act_petition  disc_social disc_gov  age edu income imm woman if nonwhite==1  & country==0

quietly eststo contact_Nocontrols_Can: logit act_contact disc_social disc_gov if nonwhite==1  & country==0
quietly eststo contact_controls_Can: logit act_contact disc_social disc_gov  age edu income imm woman if nonwhite==1  & country==0

 esttab protest_Nocontrols_Can protest_controls_Can boycott_Nocontrols_Can boycott_controls_Can petition_Nocontrols_Can contact_controls_Can  ///
 using SpecificGovSocialCan.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Canada - Specific Actions With Political and Social Discrimination\label{tabSpecificGovSocialCan})   nonumbers ///
 mtitles("Protest" "Protest" "Boycott" "Boycott" "Petition" "Petition" "Contact" "Contact" ) eqlabels(" " " ") ///
 varlabels(_cons Intercept)
 
 //UK
quietly eststo protest_Nocontrols_UK: logit act_protest disc_social disc_gov if nonwhite==1  & country==3
quietly eststo protest_controls_UK: logit act_protest  disc_social disc_gov  age edu income imm woman if nonwhite==1  & country==3

quietly eststo boycott_Nocontrols_UK: logit act_boycott disc_social disc_gov if nonwhite==1  & country==3
quietly eststo boycott_controls_UK: logit act_boycott disc_social disc_gov age edu income imm woman if nonwhite==1  & country==3

quietly eststo petition_Nocontrols_UK: logit act_petition disc_social disc_gov if nonwhite==1  & country==3
quietly eststo petition_controls_UK: logit act_petition  disc_social disc_gov  age edu income imm woman if nonwhite==1  & country==3

quietly eststo donate_Nocontrols_UK: logit act_given disc_social disc_gov if nonwhite==1  & country==3
quietly eststo donate_controls_UK: logit act_given disc_social disc_gov  age edu income imm woman if nonwhite==1  & country==3

 esttab protest_Nocontrols_UK protest_controls_UK boycott_Nocontrols_UK boycott_controls_UK petition_Nocontrols_UK petition_controls_UK donate_Nocontrols_UK donate_controls_UK  ///
 using SpecificGovSocialUK.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(UK - Specific Actions With Political and Social Discrimination\label{tabSpecificGovSocialUK})   nonumbers ///
 mtitles("Protest" "Protest" "Boycott" "Boycott" "Petition" "Petition" "Donate" "Donate" ) eqlabels(" " " ") ///
 varlabels(_cons Intercept)
 
 
 
 
 
 ////////////////////////Political and Social Discrimination - More controls

eststo  clear


//Canada
quietly eststo int_Nocontrols_Can: reg interest disc_social disc_gov if nonwhite==1  & country==0
estimates store can_int
quietly eststo int_controls_Can: reg interest  disc_social disc_gov  age edu income imm woman   partisan trust if nonwhite==1  & country==0
estimates store can_int_controls

quietly eststo vote_Nocontrols_Can: reg vote_scale disc_social disc_gov if nonwhite==1  & country==0
estimates store can_vote
quietly eststo vote_controls_Can: reg vote_scale disc_social disc_gov age edu income imm woman  interest  partisan trust  if nonwhite==1  & country==0
estimates store can_vote_controls

quietly eststo Action_Nocontrols_Can: nbreg pol_action disc_social disc_gov if nonwhite==1  & country==0
estimates store can_act
quietly eststo Action_controls_Can: nbreg pol_action  disc_social disc_gov  age edu income imm woman  interest  partisan trust  if nonwhite==1  & country==0
estimates store can_act_controls

//UK
quietly eststo int_Nocontrols_UK: reg interest disc_social disc_gov   if nonwhite==1  & country==3
estimates store uk_int
quietly eststo int_controls_UK: reg interest disc_social disc_gov  age edu income imm woman    partisan trust efficacy i.ethnicUK if nonwhite==1  & country==3
estimates store uk_int_controls

quietly eststo vote_Nocontrols_UK: reg vote_scale disc_social disc_gov  if nonwhite==1  & country==3
estimates store uk_vote
quietly eststo vote_controls_UK: reg vote_scale disc_social disc_gov   age edu income imm woman  interest  partisan trust efficacy i.ethnicUK if nonwhite==1  & country==3
estimates store uk_vote_controls

quietly eststo Action_Nocontrols_UK: nbreg pol_action disc_social disc_gov    if nonwhite==1  & country==3
est store uk_act
quietly eststo Action_controls_UK:   nbreg scale_act disc_social disc_gov  age edu income imm woman  interest  partisan trust efficacy i.ethnicUK if nonwhite==1  & country==3
est store uk_act_controls


coefplot (can_act) (uk_act, msymbol(D)) ,  keep( disc_social disc_gov)  xline(0,  lcolor(black)) bylabel(Bivariate - Actions) ///
name (act_bi, replace)  nodraw  scheme (plottig) title(Political Actions - Bivariate)   xlabel(0(0.5)1.5) xscale(range(-0.1(0.1)1.5))

coefplot can_act_controls uk_act_controls , keep( disc_social disc_gov )  xline(0,  lcolor(black))  bylabel(Bivariate - Actions) ///
name (act_multi, replace) nodraw  scheme (plottig) title(Political Actions - Controls) xlabel(0(0.5)1.5) xscale(range(-0.1(0.1)1.5))

coefplot  can_vote  (uk_vote, msymbol(D)) , keep( disc_social disc_gov )  xline(0,  lcolor(black))  bylabel(Bivariate - Actions) ///
name (vote_bi, replace) nodraw scheme (plottig) title(Turnout - Bivariate)

coefplot can_vote_controls  (uk_vote_controls, msymbol(D))   , keep( disc_social disc_gov ) xline(0,  lcolor(black))bylabel(Bivariate - Actions) ///
name (vote_multi, replace) nodraw   scheme (plottig)  title(Turnout - Controls)

coefplot can_int (uk_int, msymbol(D))  , keep( disc_social disc_gov )  xline(0,  lcolor(black))  bylabel(Bivariate - Actions) ///
name (int_bi, replace) nodraw    scheme (plottig) title(Interest - Bivariate) legend( order(2 "Canada" 4 "United Kingdom"))

coefplot can_int_controls (int_controls_UK, msymbol(D))   , keep( disc_social disc_gov ) xline(0,  lcolor(black))  bylabel(Bivariate - Actions) ///
name (int_multi, replace)  nodraw  scheme (plottig)  title(Interest - Controls) 


grc1leg2 int_bi vote_bi act_bi int_multi  vote_multi act_multi,  col(3)   scheme (plottig) lcols(2)

graph export "Gov and Social More Controls.pdf", as(pdf) replace


esttab int_Nocontrols_Can int_controls_Can   ///
vote_Nocontrols_Can  vote_controls_Can    ///
 Action_Nocontrols_Can  Action_controls_Can  ///
 using GovSocialMoreControlsCan.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Political and Social - Additional Controls Canada\label{tabGovSocialMoreCan})   nonumbers ///
 mtitles("Interest" "Interest"   "Turnout" "Turnout" "Actions" "Actions"  ) ///
 varlabels(_cons Intercept)
 

 
esttab  int_Nocontrols_UK int_controls_UK ///
 vote_Nocontrols_UK vote_controls_UK ///
Action_Nocontrols_UK Action_controls_UK ///
 using GovSocialMoreControlsUK.tex ///
 , replace se ar2 pr2 b(2) compress modelwidth(5) nobaselevels  label title(Political and Social - Additional Controls UK\label{tabGovSocialMoreUK}})  nonumbers ///
 mtitles("Interest" "Interest"   "Turnout" "Turnout" "Actions" "Actions"  ) ///
 varlabels(_cons Intercept)
 

 
 
 
 
 
